package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 28779
 * Date: 2023-04-02
 * Time: 10:26
 */
class Alg<T extends Comparable<T>>{
    //public Object[] objects = new Object[10];
    public T findMax(T[] array){
        T max = array[0];
        for (int i = 0; i < array.length; i++) {
            if(max.compareTo(array[i])<0){
                max = array[i];
            }
        }
        return max;
    }
}
public class Test2 {
    public static void main(String[] args) {
        Alg<Integer> alg = new Alg<>();
        Integer[] array = {1,5,4,2,6,9,10};
        Integer max = alg.findMax(array);
        System.out.println(max);

    }
}
